//
//  OpenCloseLockView.m
//  wjstoreboardtest
//
//  Created by 杜文杰 on 2018/10/23.
//  Copyright © 2018年 dwj. All rights reserved.
//

#import "OpenCloseLockView.h"

@implementation OpenCloseLockView
- (IBAction)openLockBtnAction:(id)sender {
    if (self.openLockBtnBlock) {
        self.openLockBtnBlock();
    }
}
- (IBAction)closeLockBtnAction:(id)sender {
    
}

+ (instancetype)openCloseLockView{
    return [[NSBundle mainBundle] loadNibNamed:NSStringFromClass(self) owner:nil options:nil].lastObject;
    
}
-(void)awakeFromNib{
    
    [super awakeFromNib];
    UITapGestureRecognizer * imagesViewTapGestureRecognizer = [[UITapGestureRecognizer alloc]initWithTarget:self action:@selector(imagesViewTap:)];
    [self addGestureRecognizer:imagesViewTapGestureRecognizer];
    
}
- (void)imagesViewTap:(UITapGestureRecognizer *)tapgesture
{
    [self hidden];
}
//出现
- (void)show{
    [[UIApplication sharedApplication].delegate.window addSubview:self];
    [UIView animateWithDuration:.15 animations:^{
        self.alpha = 1;
    }];
}

//消失
- (void)hidden{
    [UIView animateWithDuration:.15 animations:^{
        self.alpha = 0 ;
    } completion:^(BOOL finished) {
        [self removeFromSuperview];
    }];
}
/*
// Only override drawRect: if you perform custom drawing.
// An empty implementation adversely affects performance during animation.
- (void)drawRect:(CGRect)rect {
    // Drawing code
}
*/

@end
